<template>
  <div id="app">
    <p>{{$store.state.count}}</p>
    <p>{{$store.getters.score}}</p>
    <button @click="add">add</button>
    <button @click="addasync">addasync</button>
  </div>
</template>

<script>

  export default {
    name: 'App',
    data() {
      return {
        message: '我是App组件'
      }
    },
    methods: {
      add() {
        this.$store.commit('add', 2)
      },
      async addasync() {
        const result = await this.$store.dispatch('addasync')
        if (result.ok == 1) {
          alert('success')
        }
      }
    }
  }
</script>

<style>

</style>
